#ifndef POLYGON_DEFS

#define POLYGON_DEFS

#include "geometry.h"

#define MaxAdjVoronoi	50

typedef struct {
	int		numPoints;
	int		leftmost, rightmost;
	int		upper, lower;
	Pt		*points;
	int		voronoiList[MaxAdjVoronoi];
	int		voronoiCount;
    Ptr     origin;
	}	Pgon;

typedef struct {
	Pgon	*poly;
	Pt		point;
	int		firstIndex, secondIndex;
	}	PolyPtRef;

#ifdef __cplusplus
extern "C" {
#endif

Pgon *newPolygon(int	numPoints, Pt *vertices);
void killPolygon(Pgon **polygon);

int middlePt (Pgon *poly, int lower, int upper);

/*	These routines are just for printing the polygons */

void initPolyPrint(void);
void endPolyPrint(void);
void printPoly(int colour, Pgon *polygon);

void nearestPoints (Pgon *p, Pgon *q, Pt *ppt, Pt *qpt, int *pidx, int *qidx);

#ifdef __cplusplus
}
#endif	

#endif
